package swingExtensions.dialog;

import io.github.jonestimd.swing.ButtonBarFactory;
import io.github.jonestimd.swing.dialog.Dialogs;
import swingExtensions.demo.FrameDemo;

import javax.swing.*;

public class DialogsDemo {

    protected JPanel createContentPanel() {
        JButton showConfirm = new JButton("showConfirm", null);
        showConfirm.addActionListener(e -> Dialogs.confirmDiscardChanges(null));
        ButtonBarFactory buttonBarFactory = new ButtonBarFactory();
        buttonBarFactory.add(showConfirm);
        return (JPanel) buttonBarFactory.get();
    }

    public static void main(String[] args) {
        SwingUtilities.invokeLater(() -> {
            DialogsDemo demo = new DialogsDemo();
            FrameDemo frameDemo = new FrameDemo(DialogsDemo.class.toString());
            frameDemo.setContentPane(demo.createContentPanel());
            frameDemo.setVisible(true);
        });
    }
}
